<template>
  <div class="aliPay">
    <div class="loading" v-if="loading">
      <img src="/imgs/loading-svg/loading-bars.svg" alt="">
    </div>
    <div class="form" v-html="content"></div>
  </div>
</template>

<script>
import {aliPay} from "../api/home";

export default {
  name: 'aliPay',
  data () {
    return {
      content: '',
      loading: true
    }
  },
  mounted () {
    aliPay({
      orderId: this.$route.query.orderId,
      orderName: '高仿小米商城',
      amount: 0.01,
      payType: 1
    }).then(res => {
      const data = res.data.data
      this.content = data.content
      setTimeout(() => {
        this.loading = false
        document.forms[0].submit()
      }, 300)
    })
  }
}
</script>

<style lang="scss" scoped>
.loading {
  height: 100px;
  text-align: center;
  padding: 30px 0;

  img {
    height: 100%;
  }
}
</style>
